#ifndef _IM_SERVER_SUBSCRIBER_CACHE_
#define _IM_SERVER_SUBSCRIBER_CACHE_

#include <map>
#include <string>

#include "http_request.h"

namespace imserver {

class SubscriberCache {
 public:
  static SubscriberCache& Instance() {
    static SubscriberCache instance; 
    return instance;
  }
  bool Add(const std::string & session, HttpRequestPtr request);
  bool Remove(const std::string & session, HttpRequestPtr request);
  HttpRequestPtr Get(const std::string & session);
  void Dump() const;
  size_t size() const {
    return cache_.size();
  }
 private:
  SubscriberCache() {} 
  std::map<std::string, HttpRequestPtr> cache_;
};

}

#endif // _IM_SERVER_SUBSCRIBER_CACHE_

